Set state attribute to correct value