Fix a bug in getdv func