Fix remove_branches functionality.

This had been broken at some point and the tests were not correctly checking it worked.