fixed an infinite loop bug. I seem to be fixing the same 5 bugs over ... and over ... and over again