Some fixes between the DB and the query