tweaks and bug fixes