detecting out of bounds