Image resize bugfixes