Memory class bug fix