fixed critical bug in inter-thread communication