"If a graph is disconnected, DFS won't visit all of its vertices. For details, see finding connected components algorithm." Reference: Algolist
You not are doing anything wrong. And your fix (finding other unvisited nodes, and starting the algorithm again) is what other implementations do.
As further visible proof, look at this excellent implementation on TimL's page. You can keep clicking and watch the DFS being executed. (Scroll down to the middle of the page.)