Update dosend and do some clean up