fixed errorhandler and added example