Fix bug with nil model