fixed some mistakes and CompareHeartBeat