Add some defensive code