Weird-ass "model is not defined" error