[#356] fixed the defer function call in all examples