fix rescue and ensure blocks (close #374)