small bug fix for document removal