fix vertex reading function