added check for empty attribute