Fixed handling of complex tags.