fix to bug where scripts are appended to table but not cleared on each run