fixed undefined offset #2276

see issue #2276