corrected function to cut line