Fixed bugs in Document Generator