Fixed another bug in document embedding