Corrected types of return values in Memory class.