Fix bug in circularize code