Fix segment writes

Query criteria was inconsistent with dbo being saved, since the
type of the ID in the query is a string, yet in the dbo it is
a long.
Merge pull request #138 from atlasapi/segment-save

Fix segment writes