Infinite loop issue

Fix #2