scripts and bug fixes