Bug fixes in stat name retrievals from db