fixed persons retrieval with memory allocation inside