Fix logic in determining ansi flag