Fixed potential undefined index