Fixed error with F not defined in average