Fix emulation bug with self-modifying code