Improved error txt method