is `valid != true` really required here ?