bug fix and change debug output