Fixing bug in models cache