Fix regression in restoring previous input values. It now segregates by type too.