Make it finally work with empty database