memory issue fixes