more explicit queries to fix postgres errors