Some bugfixes and proper Logging