changed how SQL is called to prevent TO