fix out of bounds error

Just ran into this segfault.