Fix for referencing first row instead of assuming $data[ 0 ] exists