handle the case that attribute values are encoded as strings
(cherry picked from commit 7c55530)