Cherry-pick commit edd549246fe2d30b5341847aaa271d57bd0f6677 from styx/grit
Fixed wrong magic comparition.