fixed conditional assignment bug in model