Ah - in the line below, type should be replaced with object.