Fixed problem with several cycles