Fixing issues #922 and #858