fixes bug reported under issue #407 comment 28556698

The original fix solved the problem for cells.rb.

The additional bug reported in comment 28556698 was similar in nature, but located in tables.rb.

This pull request fixes the new bug, including test cases.

<!---
@huboard:{"order":603.0}
-->