Added check to see if contactSurface is defined before trying to export it