remove useless code
pass in syncing of no more data to send
fix elif position in code