handle orientation with backward compatibility