small fixes to sql-rewrite to make the test run without errors