fixed toObject from object (see #75)