Replaced IOError for ValueError in classes