defensive programming check