fixing nullpointers