Bugfixes for jpgs