modify some bugs and retsend function