adding a check for console undefined