Fix logic issues with the cache and mess up with parameters.