add errorHandler, other minor changes