Fix bug on defer.