Fix bug with a new matprem and popup