Fix script locking