debugging output and correcting bugs