More tests, fixes for bugs found in tests, escaping