Use nanmin for finding mins, not nanmax fool