Bugfixes for reorder keys alongside the tests for it.