handle flags