improve record and add a test