fixed silly mistake leading to index error