fix query - had execute in the wrong place