minor fix:  check undefined variable