Fixed some bugs with plugins