Fix instruction restore bugs