tests and fix for correctly handling the fail_with handler