updated scripts to fix bugs