Fix material detection