fixed bug with non-square images