fix thumbnail management and make it working also in debug mode