Fixed undefined offset bug.