minor query optimization