Fixed some crash bugs, because of not checking structure return values for init.