fixing bug with no parameters in sql