defensive value checking