Fixed bug where form was being submitted after flags were read