Fix bug on handler function