Fix Rebase

Fixes bugs in `rebase`'s implementation as well adjusts some of the tests case's expected behavior.