Fixed bug in data retrieval