tiny optimisation (remove a repeated test)