Rewrite error and monitor event callback API