fix for issue 1057

Fixes #1057 by @dwf