Fixed data retrieval to match current database status