fixed more db bugs