defensive code around nil-conditions