Fix the bug in checkNull