Added debug mode
Fixed debug