Fixed memory out of range error.