fixed the calling select by undefined index