batch_admin, fix sql queries