Fix file locking