Rebuild script fixes