Improved autoloading of embedded documents, added protection against unsafe queries.