small fix in mapAttributes: index j will change when attributes with NA values are removed