Fixed NPE for count distinct single function.