buggy dfs on classes