Fix case where duplicate objects are being created