Backported changes from original plugin-3.3 maintenance branch