New test.
Fixed #8.
Fixed #5, #6.