Replace MIN() and MAX() with FFMIN() and FFMAX()