This check looks correct.  The one on line 438 doesn't.