fixed but where max issue compared against min issue incorrectly