removeInvalidParticles bug fix