Fix #15 infinite roop problem