Some miscellaneous tweaks and fixes