Fixed bugs in detector.py and test_model.py.