API fixes to conform to new database structure