improve defer