edits to fix segmentation faults

previous record optimizations were raising segmentation fault due to direct referencing