fixing db bugs