cannot read property of undefined fixed

fields seems to be undefined sometimes.