Fix bug in callback