Added guard clauses to prevent null nodes in ImageExtractor