improve check alive routine