Everything i read suggested that punishing a cat will only confuse him, especially if it is done at any time distant from the "offense." The way i understand it, either they have an aversion to their box (covered boxes can seem claustrophobic and retain odors) or they develop a preference for the new site. So the goal is to make the box more appealing. This would be by putting it in a quiet place, not next to the boiler or washing machine; keeping it superclean, trying different brands of litter and different surfaces (ie if he likes floorboards maybe try no litter); ideally you could put down several kinds of litter boxes and see if he likes any of them. Next is make the spot he chooses unappealing. Putting double stick tape is supposed to be good, or plastic. Finally, if you can pinpoint any environmental change (other animals, people, etc) that provokes the events, that could help. Good luck to you and your cat.