fix the helper function and test case while checking null value