Compensation and improvement for bunch length diagnostics based on RF-phasing techniques