fixed lots of things with sqlite