more memory fixes