Improve README.md exmaple code to prevent TypeError