issue #573 - this may not fix everything in that issue but should resolve some of it.