remove unuse var
fix off by one error
fix off by one error