bug fixes to openCV