fix array bounds check
remove trailing whitespace
remove trailing whitespace