added std:: to cerr and endl