support for document level config, fix bugs in config serialization, back support for docs without config, closes #35