why do we need the length test?
I tested on chrome console the following coed and got no errors:
$('.foo').flot_pie()