Fix out by 1 bug