Fix memacces bug revealed by recent code cleanup