Plug binding backport

This fixes the crash Ivan described in #974.