update debug output
few bug fixes