add debugging functionality

- some minor fixes