Fix some nullpoition exception bug