Fixed a bug where database requests were made before it is ready.