Boundary conditions and spurious singularities in classical gauge theories