Fixed error where attributes could be undefined in building selector.