couple of bug fixes and extra tweaks