added write method for type