fixes error in sql query (parameter)