Fix bug in auto rotate
Improving parameter parsing.