Fixed off-by-one error

Signed-off-by: Alexey Galakhov <agalakhov@gmail.com>