edit uploadUnitHandler function