handled null pointer exceptions