Improve record type handling