add defer test code