fix staging document logic