fixed crash and dead-block