Fix for EMA calculation