Tangent Space Matrix

Hello all,

im currently implimenting Dot3 Bump mapping
in the graphics side of my engine and am
having problems generating the tangent
matrix,could anyone possibly point out what
is wrong with the following code

function TangentMatrix16(T: PTexCoords2f ;N: PVector3f): TMatrix16f;
var
t3d,b: TVector3f;
begin
Result := NullMatrix16;

t3d := Vector3f(T[0],T[1],0);
Normalize(t3d);

Result[0] := t3d[0]; Result[1] := t3d[1]; Result[2] := t3d[2];
CrossProd(@n,@t3d,b);
Normalize(b);
Result[4] := b[0]; Result[5] := b[1]; Result[6] := b[2];
Result[8] := n[0]; Result[9] := n[1]; Result[10] := n[2];

Result[15] := 1;
end;

Many thanks

Mark