fixed crash caused by invalid delegate