fixed js bug for empty lists