Fixed some bugs that sneaked by during the upgrade and made a few minor improvements