Guard against out of bounds exceptions