Tentative fix for issue 1099
This should have been commited for the fix for 1099
Second attempt for 1099, would need serious refatcoring if it does work
Finally a more proper fix for issue 1099
Merge pull request #1106 from pculture/gh-1099

Gh 1099