fix array boundary warning