bug fix and cleanup debug reporting