fixed problem with dispatching callbacks on the wrong thread