fix one bug with long input vectors and match the implementation to the doc for clocks.