Readd fixes from previous patch that were lost in latest update.

This fixes some errors during document generation.