fix logic bug in constraint removal