Memory improvement - minor bug fix