Fixes a bug in SubEntity class with material