Try to add a little safety to some operations.