A modified defect function for wave boundary layers