Changed handling of labels to circumvent pickling problems.