Fixes a problem with particles leaking out of a closed box

Fixes a problem with particles leaking out of a closed box