Change tests to accomodate afterEach, fixes #797