Fix comparing min and max