Wrapped db init with transaction. Dunno why I didn't think of that a long time ago.