fix document appending