Fix logging with freeing from troll hell