removed debugs and added an error reporting event