Fixing a bad goto behaviour