adding null check and thrwing an exception that contains more info that null pointer exception