Reverse: add guard against empty remainder.

This fixes #521, plus regression test.
Merge pull request #522 from mwmiller/empty_reverse

Reverse: add guard against empty remainder.