Remember last orientation

This might help with #4533.