bug fixes and script updates