Fixed bug with masking in cosmicray_clean

fixes a bug in the cosmic ray cleaning