Fix endless loop
Fix ClassUtils and add testcases