fixes the condition whether $x is negative or not.