fixed rotate to work with N rotates