Correction to issue #75

This should be the correct fix as it should check for null on the local $element instead of the object's global $element.