fixed with trunk

- fixed patch to aply cleenly to current trunk.
- fixed emu itself to work with current trunk.