Minor fixes to help memory