fix length of 'type' variable