Serious bug solved
rectangular images are now reshaped properly
but not elegantly