Fixing issue with charAt and arrays.