Fixing issue where no dashboard creates null, javascript error as well