Fix out-of-bounds error when using OpenMP threading. Closes #255 on github.