added memory allocation check