Most people keep their hens from sleeping in the boxes to keep them from pooping in there. Healthy hens go to bed with a full crop and digest food through the night meaning every morning there is a little pile of poo under the roosts. If they sleep in the boxes all of this poop will be in the boxes and thus on the eggs.
If you are having this problem, make sure that your roosts are higher than your boxes and in a place the hens feel safe sleeping. If they are still sleeping in the boxes, block them off right before bedtime so it is not an option. You can even set them on the roosts if they do not go up themselves. First thing in the morning, unblock the boxes so they can lay. Once they have been roosting for a week like this they will have a new routine and you can stop blocking.