fixing toObject