only register error handler once