Null pointer exception handling fixes for Capture export