Fix copying of pointers in structs