fixed bug with rotations and flips.