Fixed some tail issues and added getMaterial.