fixed crashes on empty list