looping fix for CLI