use sendto() properly and fix issue #12