Small fixes and tbl-sql.r revert