modified one to check for null attribute name