Fixed orientation bugs

fixed bugs relating to device orientation