Minor tweaks to fix some issues and prevent others