Fix a bug where objects are created needlessly