should this be inspecting b[r$] instead of b?