Add debug msgs and fix unicode problems