Fixed datasets.length undefined bug