improved caching of nodes with prefix