Minor fixes, infinite loop