Fix logic in d1e21592266f42627fda1a19e7bb8ab888968c70