Prims algorithm problem fixed