misc tweaks and bug fixes