Updated DatabaseHelper.

Also fixed a NPE in MainActivity.