apro_gen: chi^2 calculation has been improved