Null pointer exception fixed