Fixes test error handling
Fixes all non-test issues noted by @almad