fixing a variable declaration so it doesn't error if data does not exist