fix a segment fault bug of callback