Fixes for embedded forms.
Also implements a 4.0.x fix for error messages.