In Hartshorne P109 he defines a sheaf $\mathcal{F}$ of $O_X$-modules to be locally free if there is an open cover of X, s.t. on each U, $\mathcal{F}|U$ is a free $O_X|U$ module of rank $I$. Then if X is connected, rank $I$ is globally well-defined. Here $(X,O_X)$ is any ringed topological space(e.g. not necessarily the structure sheaf of a ring). A similar definition is here link text

However, it didn't seem obvious to me that if $V$ is a smaller open set included in $U$(say $U$ connected), then the number of copies $J$ of $(O_X|V)^J=\mathcal{F}|V$ would remain the same, because in general the restriction map of the sheaf $O_X$ or $\mathcal{F}$ from $U$ to $V$ need be neither subjective nor injective, why would the index $J$ stay the same as $I$?