fixed read/write locking pattern (#5)