minor code fixes and additions