fixed possible exception in ensure block that caused the original
exception to be eaten