Updates:

- More debug output
- Fix startup and shutdown wait for processes
- Fix some more queries