bug fix in traverse calculation