correcting logic for different sized arrays; closes #44