Improve image handling, remove useless debug