Fixes to make main work in case of inf's