use .data instead of parsing
check for undefined name as well