Fixed optimized tags for restore and rotate

Fixed optimized tags functions for restore and rotate.