Fixed NPE when a null function is used