AST serialization fixes