fixed undefined index error