Update commonfunc.cpp