Bugfix and changes to image transformation