Fixed some issues with multiple script runs