Fixed handling of orientation change.