added enum support for writing