Simplify/fix plugin locking.