fixed naming and variable placement in queries2