fix script for documents