fixed orientation calculation