Fixed database issues related to unsynchronized reads