Correct 'ValueError' usage to work with py3