Many bug fixes and minor tweaks

Code stuck in infinite loop with registers = 0 and pc = 2