Update cap_pvapi.cpp

Adapted with the input of Shai