resolve access of outer scope locals
try to handle unicode error output more gracefully