Added cleanup code for extern_types