added condition to handle empty attributes values