Fix some plugins related bugs