Fix 'The truth value of an array' error