Fixed a record bug in the python backend