Bug fix for document export