Fix Gram-Schmidt orthogonalization