Update model.php

Fixed a read bug where it would loop forever.