fix precedence swap bug