Fixing bug with constrain errors