Fixed casting error crash.