Added debug check to print logs