misc minor code fixes