Fixes to attach plugin