Update clip_bad_data to actually clip the bad data