The interaction between the undertow and the boundary layer flow on a beach