Fixed bug in document-creating thread, closing #68.