refactored tests to make them less brittle