Fixed segmentation faults and locations of key variables in memory