Fixed possible out of bounds read.