fix auto detect orientation