Fix error on empty collection and add config