Fix goto and check bug