Fix bug when calling callback