change min to fmin (fix compiling)