Fixed bug with docField; added some error logging.