Fixed null pointer exception crash
Added db stuff