some tweaks, bug fixes