Fix freeze bug due to incorrect coding in callback

And also clean up compile warning for unused var.
Remove unused field and warning
Merge remote-tracking branch 'upstream/develop' into develop
Changes by Prof. Rich!