add begin rescue and ensure