Added directory locking