fix findmax and findmin with NaNs more generally

a couple tests the last version did not pass