Fix for issue 6864
Fix #6840
Fix for issue #6799
Merge pull request #26 from tipitnet/test

Fixes for #6864, #6840 and #6799