fix division bug in mov-avg function