Reimplement fixes and add asserts to tests