Unit tests

Fixed tests broken in last commit.
Added tests to show bug apparently caused by commit 6c28afa3598c57034b90f5490e1da900ee834890 related to the E prefix in SQL.