Fixed bug in document store

Restore working now!