use detail property to store handler args, improve error message
code refactoring