fix out of bound error
update