Fix issue 349

I believe this fixes #349