Fix UnboundLocalError on try.