Serialize database access.
Merge pull request #22 from chiro/lock

Serialize database access.