Fix summary

These commits focus on trace.summary. The first two commits fix errors I was getting when running trace.summary (please see commit messages for specifics). The second two commits are for reorganization/testing purposes and are not necessary for fixing the errors.