javascript: add hack to check for undefined