Removing trailing empty object