Update arch.py

Added the rebase command, multiple bugfixes.