additional checks in code for undefined troubling