Fixing some errors with sqlite