updated rebuild script