Fix silly issue of generating material ID