fixed structure
fix debug printing code, add handlers in generator