Problem with point lights in custom light

Well, as the title says, there is a weird glitch when i put several objects in the scene, some of them start flickering black. i tried to debug the error, and it appears to be that when i calculate the light/shadows throught the "dot" node with the world normal and the world light direction node, it doesnt pick anything, unless i add a directional light. look:

and this is my node tree:

and this is what i get when i debug the light calculation without a directional light:

and with the directional light enabled (with black color):

how can i solve this?
after all, i'm trying to make a cartoon shader.

and this is my node tree:

and this is what i get when i debug the light calculation without a directional light:

and with the directional light enabled (with black color):

how can i solve this?
after all, i'm trying to make a cartoon shader.