fixed subtyping write code