correct logic bug in bufix for fix tmd
(cherry picked from commit 267c1ec95783782a7a15132921a9f62737311d18)