Make code compatible with the latest version of cms