fixed document deletion bug