robustified ply file handling