fixed crashing issue (restores regs)