fixed error when document doesn't exist in db, #61