fixing out-of-bounds errors (again) in master branch (rarity commit 91f77cfa)