fixed crash and error