change error Q variable to the global Q