Fix crashed and errors