add error handling for tr with undefined argument