fix a little bug at if stmt and finish output if stmt