Fixed incorrect pointer type passed to clear callback state
Correctly test both IO context and callback context pointers