fix initial loading + db bugs