Accounted for possible empty array value, which could cause a PHP warning