fix various bugs with manipulating structs