Fix unittest and occuration counter. Complete detection of unused variables.