add code for fixing bad crystals