close #225
reclosing issue 225, fixed null pointer exceptions for database calls.

Dear Santa,
For christmas this year i would really like this code to work.
I will leave milk and cookies for you as a tribute to you, and
your awsome magical powers