Fixing nullpointer