New tests and some bugfixes

Several tests are currently marked as xfail due to unresolved bugs