fixed problem in test_mode()