Fixed bug with zscore algorithm