fix bug in using HeartBeatThread