adding error monitoring