set the material indexes correctly.
How to:
Add the cube material to the materials
loop over result.geometry.faces as searchFace
search for a face with same vertices as searchFace in geometry.faces
if found then add the materialindex of the face to searchFace
if not found, search for a face with 2 of the same vertices as searchFace in geometry.faces
if found then add the materialindex of the face to searchFace
if not found, search for a face with 1 of the same vertices as searchFace in geometry.faces
if found then add the materialindex of the face to searchFace
if not found add the material index of the cube material