fix off-by-one error in OffsetMap

Also add a basic test :)