fixed crash bugs