improve code when read mesh from file