> val.append(val);

Supposed to be : 
> val.append(h); 

.. I suspect.