fix bug for image orientation