Fix Tests and SQLGenerator