More defensive code