Debugging for nullpointer exception