add some comments and logs for debugging, has some dead lock issue now