fix redundant calculation