Added a check to avoid crash when no data have been loaded yet.