Fix bug for afterMethod