added protection for rebuilding when not needed