Fixed bug on isLoop condition / more tests