Fixed callbacks pointing to writer out of scope.