Fixed min/max calculations