bugfix: out of range bug