Added file-locking (Should work in NFS (Needed in distributed codes))