Locking added to dbmstorage to fix concurrency issues. Optimized some queries such as prefix and regex list.