Fix fork cleanup code