Sorted out an invalid array reference