fixed sign for max and min