fixed undefined variable and missing argument error in model