Fixed some openCv bugs