Fixing some program flow errors.