minor tweaks and bug fixes