various bug fixes additional write-up