OnCollisionEnter If statement error

What's wrong with this script?

function OnCollisionEnter(collision : Collision) {
    if (collider.gameObject.CompareTag("Level")) {
        // Rotate the object so that the y-axis faces along the normal of the surface
        var contact = collision.contacts[0];
        var rot = Quaternion.FromToRotation(Vector3.up, contact.normal);
        var pos = contact.point;

        Instantiate(explosionPrefab, pos, rot);
        // Destroy the projectile
        Destroy (gameObject);

It works fine without the if statement, but if I add it, nothing happens when my bullet hits something. I've spent way too much time on this, and would appreciate help. There appears to be nothing wrong with it, except the obvious - it's not working. Sigh.

It looks like you said collider.gameObject when you meant to say: