Works when testing manually, but not in test framework