bugfixes
improved logging/implemented shutdown