fixed crash code.