Fixed strange behaviour in handling of shared components