Fix #878
Unit test