Fix bug introduced by singleton key patch.
Add regression tests for singleton key tables.