fix of inital div/0 error, updating of indicies