Fixing incorrect model function