Added a test case which makes the code before the send callback fix fail
Fixed bugs in previous send callback fix and updated test cases