fixed undefined index