Added some debug messages
Fixed debug flag