added tests for compaction. fixed compaction bugs and one indexing bug (had been using relative pos instead of absolute pos, which led to some strange byte-reading errors). compaction tests all pass.