New shock detector and improved control function for shock-boundary layer interaction