Fix bugs regarding plugins