Fix problem with scaling media creating badly skewed images

Fixes #188