More defensive programming