fixed bugs with visual editor and code generation