Fix for leaving form in layouts