added scripts and bug fixes