added writeVarDecl
merged with head