some fixes and script tweaks