Fixed some sqlite errors