fix out-of-bounds bug