bug fix and small code optimization of addRowData

Hello Tony,

I prepared pull request based on [the bug report](http://www.trirand.com/blog/?page_id=393/bugs/bug-in-addrowdata-method).

Best regards
Oleg