fixed maximum/minimum extrema checks