ported patch to plugin