NormalFromHeightmap not working with texture Object switch.

When I switch between 2 texture objects, the NormalFromHeightmap gives a zero output(black), like this:

But it works when I connect them directly. like this:

Is it a bug or am I doing this wrong? Tried in 4.13 and 4.14,same problem.