Close GH-29: fix bug caused by early exit.