modify material order function