Fixed bindex bug in model.py