fixed some out of bounds exceptions