Fix freeze bug due to incorrect coding in callback

And also clean up compile warning for unused var.
Remove unused field and warning