make db synchronized so it can be used in async tasks