fixes #2741 - misc code fixes