small tweaks and bug fixes