Handled null pointer exception