minor changes to behavior writer class to improve generated code quality