bug fix in class def and default main generation