fix some memory allocation issues