fixed bug when converted to plugin