* fix possible write outside array bounds (patch by Todd Blackmon)