changed char handling
added debug feature