Workaround for the index out of bounds error.