fixed type checking for polymorphic equal and less