fix bug in get_writable_struct_pointer