Fixes log pruning

and a log rotation issue preventing rotations to happen properly.