Methods of covalently attaching heparin to a membrane comprising plasma treating the membrane to produce an amino-functionalized membrane; and reacting the amino-functionalized membrane with heparin under conditions in which heparin becomes covalently attached to the amino-functionalized membrane, wherein said heparin is indirectly attached via a spacer to said amino-functionalized membrane and/or said heparin is attached from a single site in said heparin to a single site on said amino- functionalized membrane or to said spacer. Also disclosed are analyte sensors.