fixed f_max calculation