Avoid undefined index warnings on $states array

Change-Id: Ia9e9247b10aba4838ec262f07afcab582a3c565e
Merge "Avoid undefined index warnings on $states array"