Fix documentation
Unit test for #825
Fix for #825
Fix for #826