Fixed orientation related bugs