Fix broken tests due to #631 changing global state