 comp = (a, b)->
-  a.toLowerCase().indexOf(b.toLowerCase()) > -1
+  a.toString().toLowerCase().indexOf(b.toString().toLowerCase()) > -1
 
 filter = (x, xs, valueAttr)->
   if x then xs.filter ((i)-> comp(i[valueAttr], x)) else xs

        ul.scrollTop -= viewport.top - item.top

    search = (q) ->
      if $scope.prevSearch != q
        $scope.shownItems = filter(q, $scope.items, $scope.valueAttr).slice(0, $scope.limit)
        $scope.activeItem = $scope.shownItems[0]
      $scope.prevSearch = q

    $scope.selection = (item)->
      $scope.selectedItem = item

      attrs.$observe 'required', (value) ->
        scope.required = value

      scope.$watch 'selectedItem', ->
        childScope = scope.$new()
        childScope.item = scope.selectedItem
        transcludeFn childScope, (clone) ->
