fix rebuild code some more