fix "has no method 'type'"