cleanup of flags