Better defensive code