Added length checking and padding for Record object