Fix handling the 'maxrecords' key and the 'records' key of the related context