updated some queries to be compatible with the new schema