Defer should return a function