fixed crash errors