writing object for bin format