modified mnist8m script