add check for top of module tree in path_to_top_of_module_tree