Fixing error with class error listeners