Fix dict iteration Exception under Python3 (close #256).