fix out_of_range bug

Signed-off-by: anti-freak <antifreak2011@gmail.com>