Closes issues #1864 and #1866