Fixing find_min and find_max