some fixes and tweaks