Fixed bug related with global variables and debug. Updated example