Various fixes to flags and forms