fixed bugs, debug output