Simplify undefined check