- fixed a bug on exit on x64 systems

- fixed a lock up on app start
- some code reorganisations