Fix undefined check