fixed the defer function call (#356)