Fixing unrefenced variable __state