Various fixes to get tests to work