fixed a undefined index error