Moved debug logging into debug if statement in __end__. - v. 1.22

Moved debug logging into debug if statement in __end__. - v. 1.22