Handle empty object at the end of an object

cbugg: close bug-822