setPath() null pointer exception fix