fix Goto bug and some minor changes