Fix index= attribute to not be added if empty