fix retrieval function