fixed memory out of bounds