added file-locking and polling in Robust I/O procedures