change premanent to rewrite in refraction method