Fixed resend bug.
Added logging support. Close #60.