Solving some nullpointer bugs in case there is no data.