Detecting title correctly. Revertred calcaulation of page dimension