check titleAsArray's length instead of comparing it with an empty list