Fix 1040

Fix for #1040 and previously unreported form layout flaws.