added length check to jquery filter