avg_amt bug fixed