Fix bug in model