fixed errors with decoding images, rotating