Bugfixes. Need to be more careful, attribute values could be primitives