fix compile bug and plot bugs