call attachData only if we have some data