Fix attach issue

Fixes #1939