Various bugfixes for images