Error handling for ply