Fixing constrain()