Fixed document deletion.
Also improved exception text, increased logging.