Fixed crashes on empty lists