Modify callback function
For compute Z (We still have a deadlock? problem in single machine)