fix error handling in test