q-learning loop not terminating bug fixed.