Refixed the memory stuff