Fixed bug in array rotate code