fixed crashes caused by using initwithXXX