Infinite loop resulted when fraction nr was at end of file