Fixed return from while bug. This caused tuby to hang