changes to remove null pointer exceptions for extraction