memory fixes on result calculation