Modified debug proc to possibly be more appropriate
Fixed odd dereference that caused segmentation faults