Added explicit read locking to avoid #39.