more bug fixing on priv.cpp