- replace numRows() calls

- fixing some namespace and syntax issues

@tanghus