Possible fix for memory allocation problems