Did you checked that this really works and that we don't check for an empty array somewhere?