Bug 904703: fix logic issue reported by Flod