small bugfixes and improved output