fixes #245 - fix bidi page issues.
Also added position sorting for right to left