added guard against empty names