Improve reflection logic in Handler functions.