Fixed issue with p.txt being destroyed mid create