a few more tweaks and bug fixes