replaced LOCK_SH (lock read) with LOCK_EX (lock write)