Try to fix the moving average function