resolve null pointer exception