Fix undefined checks