fix Material Flow query