Fixed query that wouldn't work when a project was selected